package com.app.lxx.pregnancyberth.ui.fragment;

import android.app.Dialog;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.app.lxx.pregnancyberth.Mvp.Presenter.BasePresenter;
import com.app.lxx.pregnancyberth.R;
import com.app.lxx.pregnancyberth.base.BaseFragment;
import com.squareup.picasso.Picasso;


/**
 * Created by Lxx on 2018/9/14.
 * Details：我的相册
 */
public class MyAlbumFragment extends BaseFragment {

    @Override
    protected BasePresenter createP() {
        return null;
    }

    @Override
    protected int setview() {
        return R.layout.activity_image;
    }

    private String imgUrl;
    @Override
    protected void initview() {
        imgUrl = getArguments().getString("imgUrl");
        ImageView image = (ImageView) findviewById(R.id.image);
        Picasso.with(context).load(imgUrl).into(image);

        image.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                View inflate = LayoutInflater.from(context).inflate(R.layout.activity_image, null);
                final Dialog dialog = utilsManage.dialog(getActivity(), inflate, Gravity.CENTER, true);
                ImageView image = inflate.findViewById(R.id.image);
                Picasso.with(context).load(imgUrl)
                        .placeholder(R.drawable.ic_merchant_logo)
                        .error(R.drawable.ic_merchant_logo)
                        .into(image);

                image.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();
                    }
                });
            }
        });

    }
}
